package com.xyoto.community.controller;

import com.xyoto.community.dto.AddSelectedRotationDTO;
import com.xyoto.community.dto.UpdateRotationChartDTO;
import com.xyoto.community.service.SelectedRotationService;
import com.xyoto.community.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @author coderFu
 * @create 2022/2/17
 * 首页精选轮播接口
 */

@RestController
@Api(value = "SelectedRotationController",tags = "首页精选轮播")
@RequestMapping("/homeSelectedRotation")
public class SelectedRotationController {

    @Autowired
    private SelectedRotationService selectedRotationService;



    @ApiOperation("添加精选轮播图")
    @PostMapping("/addSelectedRotation")
    public Result addSelectedRotation(@Valid AddSelectedRotationDTO addSelectedRotationDTO){
        return selectedRotationService.addSelectedRotation(addSelectedRotationDTO);
    }

    @ApiOperation("更新精选轮播图")
    @PutMapping("/updateSelectedRotation")
    public Result updateSelectedRotation(@Valid UpdateRotationChartDTO updateRotationChartDTO){
        return selectedRotationService.updateSelectedRotation(updateRotationChartDTO);
    }

    @ApiOperation("查询正在展示的轮播图")
    @GetMapping("/getShowSelectedRotationList")
    public Result getShowSelectedRotationList(){
        return selectedRotationService.getShowSelectedRotationList();
    }


}
